home *** CD-ROM | disk | FTP | other *** search
/ PC Home 49 / PC_Home_Issue_49.iso / lldemo / lldemo.shr / ROSETTA.EXE / ROSETTA.DXR / 00569_pref file I-O.ls < prev    next >
Encoding:
Text File  |  1996-06-24  |  2.7 KB  |  83 lines

  1. on readprefs
  2.   global gType, gStuMethod
  3.   if gType = #MAC then
  4.     set fname to the pathName & "Rosetta Prefs"
  5.   else
  6.     set fname to the pathName & "rosetta.prf"
  7.   end if
  8.   set gStuMethod to [:]
  9.   set prefFile to FileIO(mnew, "read", fname)
  10.   if objectp(prefFile) then
  11.     set prefLine to prefFile(mReadLine)
  12.     set acrobatPath to prefFile(mReadLine)
  13.     put prefLine
  14.     put acrobatPath
  15.     if voidp(acrobatPath) then
  16.       set acrobatPath to EMPTY
  17.     end if
  18.     prefFile(mdispose)
  19.     set gStuMethod to value(prefLine)
  20.     if listp(gStuMethod) then
  21.       setaProp(gStuMethod, #acrobatPath, acrobatPath)
  22.       set v to getaProp(gStuMethod, #volume)
  23.       set n to getaProp(gStuMethod, #no_sound)
  24.       set y to getaProp(gStuMethod, #yes_sound)
  25.       set i to getaProp(gStuMethod, #icons)
  26.       set acrobatPath to getaProp(gStuMethod, #acrobatPath)
  27.       if voidp(v) or voidp(y) or voidp(n) or voidp(i) or voidp(acrobatPath) then
  28.         set gStuMethod to [:]
  29.       else
  30.         if (v < 1) or (v > 7) or ((i <> #check) and (i <> #smiley)) or (y < 1) or (y > 8) or (n < 1) or (n > 8) then
  31.           set gStuMethod to [:]
  32.         end if
  33.         if not stringp(acrobatPath) then
  34.           set gStuMethod to [:]
  35.         end if
  36.         if acrobatPath = EMPTY then
  37.           set gStuMethod to [:]
  38.         end if
  39.       end if
  40.     end if
  41.   end if
  42.   if gStuMethod = [:] then
  43.     set prefLine to "[#yes_sound: 1, #no_sound: 1, #icons: #Check, #volume: 4]" & numToChar(10) & numToChar(13)
  44.     set acrobatPath to "C:\ACROREAD\ACROREAD.EXE"
  45.     set gStuMethod to value(prefLine)
  46.     set prefFile to FileIO(mnew, "write", fname)
  47.     if objectp(prefFile) then
  48.       prefFile(mWriteString, prefLine)
  49.       prefFile(mWriteString, acrobatPath)
  50.       if gType = #MAC then
  51.         prefFile(mSetFinderInfo, "PREF", "FLT0")
  52.       end if
  53.       prefFile(mdispose)
  54.     end if
  55.     setaProp(gStuMethod, #acrobatPath, acrobatPath)
  56.   end if
  57.   registerVolume(getaProp(gStuMethod, #volume))
  58. end
  59.  
  60. on savePrefs
  61.   global gType, gStuMethod
  62.   set prefs to [:]
  63.   setaProp(prefs, #yes_sound, getaProp(gStuMethod, #yes_sound))
  64.   setaProp(prefs, #no_sound, getaProp(gStuMethod, #no_sound))
  65.   setaProp(prefs, #icons, getaProp(gStuMethod, #icons))
  66.   setaProp(prefs, #volume, getaProp(gStuMethod, #volume))
  67.   if gType = #MAC then
  68.     set fname to the pathName & "Rosetta Prefs"
  69.   else
  70.     set fname to the pathName & "rosetta.prf"
  71.   end if
  72.   set prefFile to FileIO(mnew, "write", fname)
  73.   if objectp(prefFile) then
  74.     set prefString to string(prefs) & numToChar(10) & numToChar(13)
  75.     prefFile(mWriteString, prefString)
  76.     prefFile(mWriteString, getaProp(gStuMethod, #acrobatPath))
  77.     if gType = #MAC then
  78.       prefFile(mSetFinderInfo, "PREF", "FLT0")
  79.     end if
  80.     prefFile(mdispose)
  81.   end if
  82. end
  83.